home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Science / RLaB / misc / configure < prev    next >
Encoding:
Text File  |  1994-04-25  |  55.4 KB  |  2,413 lines  |  [TEXT/EDIT]

  1.  
  2.  
  3. #!/bin/sh
  4. progname="`echo $0`"
  5.  
  6. ## Usage messages.
  7.  
  8. short_usage="Usage: ${progname} [--with-LIBS=dir] ...
  9.  
  10. Set compilation and installation parameters for RLaB.
  11. --with-LIBS=DIR        Add DIR to list of directories to search for
  12.             ALL libraries.
  13. --with-NALIBS=DIR    Search for Numerical Analysis libraries in DIR.
  14. --with-FLIBS=DIR    Search for Fortran libraries in DIR.
  15. --with-PLIBS=DIR    Search for PLPLOT Library in DIR
  16. --with-gcc        Force usage of the GNU C compiler.
  17. --with-cc        Force usage of cc(1)
  18. --prefix=DIR        Set the Makefile variable \'prefix\' to DIR.
  19.             RLaB will be installed with DIR as the root
  20.             directory.
  21.  
  22. If successful, ${progname} leaves its status in config.status.  If
  23. unsuccessful after disturbing the status quo, it removes config.status."
  24.  
  25.  
  26. #!/bin/sh
  27. # Guess values for system-dependent variables and create Makefiles.
  28. # Generated automatically using autoconf.
  29. # Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
  30.  
  31. # This program is free software; you can redistribute it and/or modify
  32. # it under the terms of the GNU General Public License as published by
  33. # the Free Software Foundation; either version 2, or (at your option)
  34. # any later version.
  35.  
  36. # This program is distributed in the hope that it will be useful,
  37. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  38. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  39. # GNU General Public License for more details.
  40.  
  41. # You should have received a copy of the GNU General Public License
  42. # along with this program; if not, write to the Free Software
  43. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  44.  
  45. # Usage: configure [--srcdir=DIR] [--host=HOST] [--gas] [--nfp]
  46. #        [--prefix=PREFIX] [--exec-prefix=PREFIX] [--with-PACKAGE[=VALUE]]
  47. # Ignores all args except --srcdir, --prefix, --exec-prefix, and
  48. # --with-PACKAGE[=VALUE] unless this script has special code to handle it.
  49.  
  50. for arg
  51. do
  52.   # Handle --exec-prefix with a space before the argument.
  53.   if test x$next_exec_prefix = xyes; then exec_prefix=$arg; next_exec_prefix=
  54.   # Handle --host with a space before the argument.
  55.   elif test x$next_host = xyes; then next_host=
  56.   # Handle --prefix with a space before the argument.
  57.   elif test x$next_prefix = xyes; then prefix=$arg; next_prefix=
  58.   # Handle --srcdir with a space before the argument.
  59.   elif test x$next_srcdir = xyes; then srcdir=$arg; next_srcdir=
  60.   else
  61.     case $arg in
  62.      # For backward compatibility, recognize -exec-prefix and --exec_prefix.
  63.      -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* | --exec=* | --exe=* | --ex=* | --e=*)
  64.     exec_prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  65.      -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- | --exec | --exe | --ex | --e)
  66.     next_exec_prefix=yes ;;
  67.  
  68.      -gas | --gas | --ga | --g) ;;
  69.  
  70.      -host=* | --host=* | --hos=* | --ho=* | --h=*) ;;
  71.      -host | --host | --hos | --ho | --h)
  72.     next_host=yes ;;
  73.  
  74.      -nfp | --nfp | --nf) ;;
  75.  
  76.      -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
  77.     prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  78.      -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
  79.     next_prefix=yes ;;
  80.  
  81.      -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=* | --s=*)
  82.     srcdir=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  83.      -srcdir | --srcdir | --srcdi | --srcd | --src | --sr | --s)
  84.     next_srcdir=yes ;;
  85.  
  86.      -with-* | --with-*)
  87.        package=`echo $arg|sed -e 's/-*with-//' -e 's/=.*//'`
  88.        # Reject names that aren't valid shell variable names.
  89.        if test -n "`echo $package| sed 's/[-a-zA-Z0-9_]//g'`"; then
  90.          echo "configure: $package: invalid package name" >&2; exit 1
  91.        fi
  92.        package=`echo $package| sed 's/-/_/g'`
  93.        case "$arg" in
  94.          *=*) val="`echo $arg|sed 's/[^=]*=//'`" ;;
  95.          *) val=1 ;;
  96.        esac
  97.        eval "with_$package='$val'" ;;
  98.  
  99.      -v | -verbose | --verbose | --verbos | --verbo | --verb | --ver | --ve | --v)
  100.        verbose=yes ;;
  101.  
  102.      *) ;;
  103.     esac
  104.   fi
  105. done
  106.  
  107. trap 'rm -fr conftest* confdefs* core; exit 1' 1 3 15
  108. trap 'rm -f confdefs*' 0
  109.  
  110. # NLS nuisances.
  111. # These must not be set unconditionally because not all systems understand
  112. # e.g. LANG=C (notably SCO).
  113. if test "${LC_ALL+set}" = 'set' ; then LC_ALL=C; export LC_ALL; fi
  114. if test "${LANG+set}"   = 'set' ; then LANG=C;   export LANG;   fi
  115.  
  116. rm -f conftest* confdefs.h
  117. # AIX cpp loses on an empty file, so make sure it contains at least a newline.
  118. echo > confdefs.h
  119. compile='${CC-cc} $CFLAGS conftest.c -o conftest $LIBS >/dev/null 2>&1'
  120.  
  121. # A filename unique to this package, relative to the directory that
  122. # configure is in, which we can look for to find out if srcdir is correct.
  123. unique_file=rlab.h
  124.  
  125. # Find the source files, if location was not specified.
  126. if test -z "$srcdir"; then
  127.   srcdirdefaulted=yes
  128.   # Try the directory containing this script, then `..'.
  129.   prog=$0
  130.   confdir=`echo $prog|sed 's%/[^/][^/]*$%%'`
  131.   test "X$confdir" = "X$prog" && confdir=.
  132.   srcdir=$confdir
  133.   if test ! -r $srcdir/$unique_file; then
  134.     srcdir=..
  135.   fi
  136. fi
  137. if test ! -r $srcdir/$unique_file; then
  138.   if test x$srcdirdefaulted = xyes; then
  139.     echo "configure: Can not find sources in \`${confdir}' or \`..'." 1>&2
  140.   else
  141.     echo "configure: Can not find sources in \`${srcdir}'." 1>&2
  142.   fi
  143.   exit 1
  144. fi
  145. # Preserve a srcdir of `.' to avoid automounter screwups with pwd.
  146. # But we can't avoid them for `..', to make subdirectories work.
  147. case $srcdir in
  148.   .|/*|~*) ;;
  149.   *) srcdir=`cd $srcdir; pwd` ;; # Make relative path absolute.
  150. esac
  151.  
  152.  
  153. # Save the original args to write them into config.status later.
  154. configure_args="$*"
  155.  
  156.  
  157.  
  158. # check whether --with-LIBS was given
  159. withval="$with_LIBS"
  160. if test -n "$withval"; then
  161.   
  162.   LIBS="-L$withval "
  163.   LLIBS="-L$withval "
  164.  
  165. else
  166.   
  167.   LIBS="-L/usr/local/lib "
  168.   LLIBS="-L/usr/local/lib "
  169.  
  170. fi
  171.  
  172.  
  173. for p in 'bison -y' byacc
  174. do
  175. if test -z "$YACC"; then
  176.   # Extract the first word of `$p', so it can be a program name with args.
  177.   set dummy $p; word=$2
  178.   echo checking for $word
  179.   IFS="${IFS=     }"; saveifs="$IFS"; IFS="${IFS}:"
  180.   for dir in $PATH; do
  181.     test -z "$dir" && dir=.
  182.     if test -f $dir/$word; then
  183.       YACC="$p"
  184.       break
  185.     fi
  186.   done
  187.   IFS="$saveifs"
  188. fi
  189.  
  190. test -n "$YACC" && test -n "$verbose" && echo "    setting YACC to $YACC"
  191.  
  192. test -n "$YACC" && break
  193. done
  194. test -n "$YACC" || YACC="yacc"
  195.  
  196.  
  197. if test -z "$FLEX"; then
  198.   # Extract the first word of `flex', so it can be a program name with args.
  199.   set dummy flex; word=$2
  200.   echo checking for $word
  201.   IFS="${IFS=     }"; saveifs="$IFS"; IFS="${IFS}:"
  202.   for dir in $PATH; do
  203.     test -z "$dir" && dir=.
  204.     if test -f $dir/$word; then
  205.       FLEX="flex"
  206.       break
  207.     fi
  208.   done
  209.   IFS="$saveifs"
  210. fi
  211.  
  212. test -n "$FLEX" && test -n "$verbose" && echo "    setting FLEX to $FLEX"
  213.  
  214.  
  215. for p in mawk gawk nawk awk
  216. do
  217. if test -z "$AWK"; then
  218.   # Extract the first word of `$p', so it can be a program name with args.
  219.   set dummy $p; word=$2
  220.   echo checking for $word
  221.   IFS="${IFS=     }"; saveifs="$IFS"; IFS="${IFS}:"
  222.   for dir in $PATH; do
  223.     test -z "$dir" && dir=.
  224.     if test -f $dir/$word; then
  225.       AWK="$p"
  226.       break
  227.     fi
  228.   done
  229.   IFS="$saveifs"
  230. fi
  231.  
  232. test -n "$AWK" && test -n "$verbose" && echo "    setting AWK to $AWK"
  233.  
  234. test -n "$AWK" && break
  235. done
  236.  
  237. # Make sure to not get the incompatible SysV /etc/install and
  238. # /usr/sbin/install, which might be in PATH before a BSD-like install,
  239. # or the SunOS /usr/etc/install directory, or the AIX /bin/install,
  240. # or the AFS install, which mishandles nonexistent args, or
  241. # /usr/ucb/install on SVR4, which tries to use the nonexistent group
  242. # `staff'.  On most BSDish systems install is in /usr/bin, not /usr/ucb
  243. # anyway.  Sigh.
  244. if test "z${INSTALL}" = "z" ; then
  245.   echo checking for install
  246.   IFS="${IFS=     }"; saveifs="$IFS"; IFS="${IFS}:"
  247.   for dir in $PATH; do
  248.     test -z "$dir" && dir=.
  249.     case $dir in
  250.     /etc|/usr/sbin|/usr/etc|/usr/afsws/bin|/usr/ucb) ;;
  251.     *)
  252.       if test -f $dir/installbsd; then
  253.     INSTALL="$dir/installbsd -c" # OSF1
  254.     INSTALL_PROGRAM='$(INSTALL)'
  255.     INSTALL_DATA='$(INSTALL) -m 644'
  256.     break
  257.       fi
  258.       if test -f $dir/install; then
  259.     if grep dspmsg $dir/install >/dev/null 2>&1; then
  260.       : # AIX
  261.     else
  262.       INSTALL="$dir/install -c"
  263.       INSTALL_PROGRAM='$(INSTALL)'
  264.       INSTALL_DATA='$(INSTALL) -m 644'
  265.       break
  266.     fi
  267.       fi
  268.       ;;
  269.     esac
  270.   done
  271.   IFS="$saveifs"
  272. fi
  273. INSTALL=${INSTALL-cp}
  274. test -n "$verbose" && echo "    setting INSTALL to $INSTALL"
  275. INSTALL_PROGRAM=${INSTALL_PROGRAM-'$(INSTALL)'}
  276. test -n "$verbose" && echo "    setting INSTALL_PROGRAM to $INSTALL_PROGRAM"
  277. INSTALL_DATA=${INSTALL_DATA-'$(INSTALL)'}
  278. test -n "$verbose" && echo "    setting INSTALL_DATA to $INSTALL_DATA"
  279.  
  280. if test -z "$F2C"; then
  281.   # Extract the first word of `f2c', so it can be a program name with args.
  282.   set dummy f2c; word=$2
  283.   echo checking for $word
  284.   IFS="${IFS=     }"; saveifs="$IFS"; IFS="${IFS}:"
  285.   for dir in $PATH; do
  286.     test -z "$dir" && dir=.
  287.     if test -f $dir/$word; then
  288.       F2C="f2c"
  289.       break
  290.     fi
  291.   done
  292.   IFS="$saveifs"
  293. fi
  294.  
  295. test -n "$F2C" && test -n "$verbose" && echo "    setting F2C to $F2C"
  296.  
  297.  
  298.  
  299. # check whether --with-cc was given
  300. withval="$with_cc"
  301. if test -n "$withval"; then
  302.   CC="cc"
  303. fi
  304.  
  305. # check whether --with-gcc was given
  306. withval="$with_gcc"
  307. if test -n "$withval"; then
  308.   CC="gcc" GCC=1
  309. fi
  310.  
  311.  
  312.  
  313. if test -z "$CC" ; then
  314.   if test -z "$CC"; then
  315.   # Extract the first word of `gcc', so it can be a program name with args.
  316.   set dummy gcc; word=$2
  317.   echo checking for $word
  318.   IFS="${IFS=     }"; saveifs="$IFS"; IFS="${IFS}:"
  319.   for dir in $PATH; do
  320.     test -z "$dir" && dir=.
  321.     if test -f $dir/$word; then
  322.       CC="gcc"
  323.       break
  324.     fi
  325.   done
  326.   IFS="$saveifs"
  327. fi
  328. test -z "$CC" && CC="cc"
  329. test -n "$CC" && test -n "$verbose" && echo "    setting CC to $CC"
  330.  
  331. # Find out if we are using GNU C, under whatever name.
  332. cat > conftest.c <<EOF
  333. #ifdef __GNUC__
  334.   yes
  335. #endif
  336. EOF
  337. ${CC-cc} -E conftest.c > conftest.out 2>&1
  338. if egrep yes conftest.out >/dev/null 2>&1; then
  339.   GCC=1 # For later tests.
  340. fi
  341. rm -f conftest*
  342.  
  343. fi
  344.  
  345.  
  346. prog='/* Ultrix mips cc rejects this.  */
  347. typedef int charset[2]; const charset x;
  348. /* SunOS 4.1.1 cc rejects this.  */
  349. char const *const *ccp;
  350. char **p;
  351. /* AIX XL C 1.02.0.0 rejects this.
  352.    It does not let you subtract one const X* pointer from another in an arm
  353.    of an if-expression whose if-part is not a constant expression */
  354. const char *g = "string";
  355. ccp = &g + (g ? g-g : 0);
  356. /* HPUX 7.0 cc rejects these. */
  357. ++ccp;
  358. p = (char**) ccp;
  359. ccp = (char const *const *) p;
  360. { /* SCO 3.2v4 cc rejects this.  */
  361.   char *t;
  362.   char const *s = 0 ? (char *) 0 : (char const *) 0;
  363.  
  364.   *t++ = 0;
  365. }
  366. { /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
  367.   int x[] = {25,17};
  368.   const int *foo = &x[0];
  369.   ++foo;
  370. }
  371. { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
  372.   typedef const int *iptr;
  373.   iptr p = 0;
  374.   ++p;
  375. }
  376. { /* AIX XL C 1.02.0.0 rejects this saying
  377.      "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
  378.   struct s { int j; const int *ap[3]; };
  379.   struct s *b; b->j = 5;
  380. }
  381. { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
  382.   const int foo = 10;
  383. }'
  384. echo checking for lack of working const
  385. cat > conftest.c <<EOF
  386. #include "confdefs.h"
  387.  
  388. int main() { exit(0); }
  389. int t() { $prog }
  390. EOF
  391. if eval $compile; then
  392.   :
  393. else
  394.   rm -rf conftest*
  395.   
  396. {
  397. test -n "$verbose" && \
  398. echo "    defining" const to be empty
  399. echo "#define" const  >> confdefs.h
  400. DEFS="$DEFS -Dconst="
  401. SEDDEFS="${SEDDEFS}\${SEDdA}const\${SEDdB}const\${SEDdC}\${SEDdD}
  402. \${SEDuA}const\${SEDuB}const\${SEDuC}\${SEDuD}
  403. \${SEDeA}const\${SEDeB}const\${SEDeC}\${SEDeD}
  404. "
  405. }
  406.  
  407. fi
  408. rm -f conftest*
  409.  
  410. echo checking for size_t in sys/types.h
  411. echo checking how to run the C preprocessor
  412. if test -z "$CPP"; then
  413.   # This must be in double quotes, not single quotes, because CPP may get
  414.   # substituted into the Makefile and ``${CC-cc}'' will simply confuse
  415.   # make.  It must be expanded now.
  416.   CPP="${CC-cc} -E"
  417.   cat > conftest.c <<EOF
  418. #include "confdefs.h"
  419. #include <stdio.h>
  420. Syntax Error
  421. EOF
  422. err=`eval "($CPP conftest.c >/dev/null) 2>&1"`
  423. if test -z "$err"; then
  424.   :
  425. else
  426.   rm -rf conftest*
  427.   CPP=/lib/cpp
  428. fi
  429. rm -f conftest*
  430. fi
  431. test ".${verbose}" != "." && echo "    setting CPP to $CPP"
  432.  
  433. echo '#include "confdefs.h"
  434. #include <sys/types.h>' > conftest.c
  435. eval "$CPP conftest.c > conftest.out 2>&1"
  436. if egrep "size_t" conftest.out >/dev/null 2>&1; then
  437.   :
  438. else
  439.   rm -rf conftest*
  440.   
  441. {
  442. test -n "$verbose" && \
  443. echo "    defining" size_t to be unsigned
  444. echo "#define" size_t unsigned >> confdefs.h
  445. DEFS="$DEFS -Dsize_t=unsigned"
  446. SEDDEFS="${SEDDEFS}\${SEDdA}size_t\${SEDdB}size_t\${SEDdC}unsigned\${SEDdD}
  447. \${SEDuA}size_t\${SEDuB}size_t\${SEDuC}unsigned\${SEDuD}
  448. \${SEDeA}size_t\${SEDeB}size_t\${SEDeC}unsigned\${SEDeD}
  449. "
  450. }
  451.  
  452. fi
  453. rm -f conftest*
  454.  
  455. echo checking byte ordering
  456. cat > conftest.c <<EOF
  457. #include "confdefs.h"
  458. main () {
  459.   /* Are we little or big endian?  From Harbison&Steele.  */
  460.   union
  461.   {
  462.     long l;
  463.     char c[sizeof (long)];
  464.   } u;
  465.   u.l = 1;
  466.   exit (u.c[sizeof (long) - 1] == 1);
  467. }
  468. EOF
  469. eval $compile
  470. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  471.   :
  472. else
  473.   
  474. {
  475. test -n "$verbose" && \
  476. echo "    defining WORDS_BIGENDIAN"
  477. echo "#define" WORDS_BIGENDIAN 1 >> confdefs.h
  478. DEFS="$DEFS -DWORDS_BIGENDIAN=1"
  479. SEDDEFS="${SEDDEFS}\${SEDdA}WORDS_BIGENDIAN\${SEDdB}WORDS_BIGENDIAN\${SEDdC}1\${SEDdD}
  480. \${SEDuA}WORDS_BIGENDIAN\${SEDuB}WORDS_BIGENDIAN\${SEDuC}1\${SEDuD}
  481. \${SEDeA}WORDS_BIGENDIAN\${SEDeB}WORDS_BIGENDIAN\${SEDeC}1\${SEDeD}
  482. "
  483. }
  484.  
  485. fi
  486. rm -fr conftest*
  487.  
  488.  
  489. if test -z "$PAGER"; then
  490.   # Extract the first word of `less', so it can be a program name with args.
  491.   set dummy less; word=$2
  492.   echo checking for $word
  493.   IFS="${IFS=     }"; saveifs="$IFS"; IFS="${IFS}:"
  494.   for dir in $PATH; do
  495.     test -z "$dir" && dir=.
  496.     if test -f $dir/$word; then
  497.       PAGER="less"
  498.       break
  499.     fi
  500.   done
  501.   IFS="$saveifs"
  502. fi
  503.  
  504. test -n "$PAGER" && test -n "$verbose" && echo "    setting PAGER to $PAGER"
  505.  
  506.  
  507.   if test -z "$PAGER" ; then
  508.      if test -z "$PAGER"; then
  509.   # Extract the first word of `more', so it can be a program name with args.
  510.   set dummy more; word=$2
  511.   echo checking for $word
  512.   IFS="${IFS=     }"; saveifs="$IFS"; IFS="${IFS}:"
  513.   for dir in $PATH; do
  514.     test -z "$dir" && dir=.
  515.     if test -f $dir/$word; then
  516.       PAGER="more"
  517.       break
  518.     fi
  519.   done
  520.   IFS="$saveifs"
  521. fi
  522.  
  523. test -n "$PAGER" && test -n "$verbose" && echo "    setting PAGER to $PAGER"
  524.  
  525.     if test -z "$PAGER" ; then
  526.        if test -z "$PAGER"; then
  527.   # Extract the first word of `pg', so it can be a program name with args.
  528.   set dummy pg; word=$2
  529.   echo checking for $word
  530.   IFS="${IFS=     }"; saveifs="$IFS"; IFS="${IFS}:"
  531.   for dir in $PATH; do
  532.     test -z "$dir" && dir=.
  533.     if test -f $dir/$word; then
  534.       PAGER="pg"
  535.       break
  536.     fi
  537.   done
  538.   IFS="$saveifs"
  539. fi
  540.  
  541. test -n "$PAGER" && test -n "$verbose" && echo "    setting PAGER to $PAGER"
  542.  
  543.     fi
  544.   fi
  545.  
  546.  
  547. cat > conftest.c <<EOF
  548. #include "confdefs.h"
  549. #ifdef titan
  550.  yes
  551. #endif
  552.  
  553. EOF
  554. eval "$CPP conftest.c > conftest.out 2>&1"
  555. if egrep "yes" conftest.out >/dev/null 2>&1; then
  556.   rm -rf conftest*
  557.   TITAN=1
  558.  
  559. fi
  560. rm -f conftest*
  561.  
  562.  
  563. echo checking for elf.h
  564. cat > conftest.c <<EOF
  565. #include "confdefs.h"
  566. #include <elf.h>
  567. EOF
  568. err=`eval "($CPP conftest.c >/dev/null) 2>&1"`
  569. if test -z "$err"; then
  570.   rm -rf conftest*
  571.   
  572. {
  573. test -n "$verbose" && \
  574. echo "    defining SVR4"
  575. echo "#define" SVR4 1 >> confdefs.h
  576. DEFS="$DEFS -DSVR4=1"
  577. SEDDEFS="${SEDDEFS}\${SEDdA}SVR4\${SEDdB}SVR4\${SEDdC}1\${SEDdD}
  578. \${SEDuA}SVR4\${SEDuB}SVR4\${SEDuC}1\${SEDuD}
  579. \${SEDeA}SVR4\${SEDeB}SVR4\${SEDeC}1\${SEDeD}
  580. "
  581. }
  582.  
  583.  
  584. fi
  585. rm -f conftest*
  586.  
  587.  
  588.  
  589. # check whether --with-NALIBS was given
  590. withval="$with_NALIBS"
  591. if test -n "$withval"; then
  592.    
  593.   echo "look for Numerical Analysis LIBS in $withval"
  594.   LIBS="$LIBS -L$withval"
  595.   NALIB_DIR="-L$withval "
  596.  
  597. else
  598.   
  599.   NALIB_DIR=""
  600.  
  601. fi
  602.  
  603.  
  604. LIBS_save="${LIBS}"
  605. LIBS="${LIBS} -lClapack"
  606. have_lib=""
  607. echo checking for -lClapack
  608. cat > conftest.c <<EOF
  609. #include "confdefs.h"
  610.  
  611. int main() { exit(0); }
  612. int t() { main(); }
  613. EOF
  614. if eval $compile; then
  615.   rm -rf conftest*
  616.   have_lib="1"
  617.  
  618. fi
  619. rm -f conftest*
  620. LIBS="${LIBS_save}"
  621. if test -n "${have_lib}"; then
  622.    :; NALIBS="$NALIB_DIR -lClapack"
  623. else
  624.    :; 
  625.    echo "WARNING: Cannot find libClapack.a,  use --with-NALIBS option" 
  626. fi
  627.  
  628. LIBS_save="${LIBS}"
  629. LIBS="${LIBS} -lCblas"
  630. have_lib=""
  631. echo checking for -lCblas
  632. cat > conftest.c <<EOF
  633. #include "confdefs.h"
  634.  
  635. int main() { exit(0); }
  636. int t() { main(); }
  637. EOF
  638. if eval $compile; then
  639.   rm -rf conftest*
  640.   have_lib="1"
  641.  
  642. fi
  643. rm -f conftest*
  644. LIBS="${LIBS_save}"
  645. if test -n "${have_lib}"; then
  646.    :; NALIBS="$NALIBS -lCblas"
  647. else
  648.    :; 
  649.    echo "WARNING: Cannot find libCblas.a,    use --with-NALIBS option" 
  650. fi
  651.  
  652. LIBS_save="${LIBS}"
  653. LIBS="${LIBS} -lCfftpack"
  654. have_lib=""
  655. echo checking for -lCfftpack
  656. cat > conftest.c <<EOF
  657. #include "confdefs.h"
  658.  
  659. int main() { exit(0); }
  660. int t() { main(); }
  661. EOF
  662. if eval $compile; then
  663.   rm -rf conftest*
  664.   have_lib="1"
  665.  
  666. fi
  667. rm -f conftest*
  668. LIBS="${LIBS_save}"
  669. if test -n "${have_lib}"; then
  670.    :; NALIBS="$NALIBS -lCfftpack"
  671. else
  672.    :; 
  673.    echo "WARNING: Cannot find libCfftpack.a, use --with-NALIBS option" 
  674. fi
  675.  
  676. LIBS_save="${LIBS}"
  677. LIBS="${LIBS} -lCranlib"
  678. have_lib=""
  679. echo checking for -lCranlib
  680. cat > conftest.c <<EOF
  681. #include "confdefs.h"
  682.  
  683. int main() { exit(0); }
  684. int t() { main(); }
  685. EOF
  686. if eval $compile; then
  687.   rm -rf conftest*
  688.   have_lib="1"
  689.  
  690. fi
  691. rm -f conftest*
  692. LIBS="${LIBS_save}"
  693. if test -n "${have_lib}"; then
  694.    :; NALIBS="$NALIBS -lCranlib"
  695. else
  696.    :; 
  697.    echo "WARNING: Cannot find libCranlib.a,  use --with-NALIBS option" 
  698. fi
  699.  
  700.  
  701.  
  702. LIBS_save="${LIBS}"
  703. LIBS="${LIBS} -lreadline"
  704. have_lib=""
  705. echo checking for -lreadline
  706. cat > conftest.c <<EOF
  707. #include "confdefs.h"
  708.  
  709. int main() { exit(0); }
  710. int t() { main(); }
  711. EOF
  712. if eval $compile; then
  713.   rm -rf conftest*
  714.   have_lib="1"
  715.  
  716. fi
  717. rm -f conftest*
  718. LIBS="${LIBS_save}"
  719. if test -n "${have_lib}"; then
  720.    :; CMDLIBS="$LIBS -lreadline"
  721. else
  722.    :; READLINE="no"
  723. fi
  724.  
  725.  
  726. if test -z "$READLINE" ; then
  727.    
  728. {
  729. test -n "$verbose" && \
  730. echo "    defining" HAVE_READLINE to be 1
  731. echo "#define" HAVE_READLINE 1 >> confdefs.h
  732. DEFS="$DEFS -DHAVE_READLINE=1"
  733. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_READLINE\${SEDdB}HAVE_READLINE\${SEDdC}1\${SEDdD}
  734. \${SEDuA}HAVE_READLINE\${SEDuB}HAVE_READLINE\${SEDuC}1\${SEDuD}
  735. \${SEDeA}HAVE_READLINE\${SEDeB}HAVE_READLINE\${SEDeC}1\${SEDeD}
  736. "
  737. }
  738.  
  739.     LIBS_save="${LIBS}"
  740. LIBS="${LIBS} -ltermcap"
  741. have_lib=""
  742. echo checking for -ltermcap
  743. cat > conftest.c <<EOF
  744. #include "confdefs.h"
  745.  
  746. int main() { exit(0); }
  747. int t() { main(); }
  748. EOF
  749. if eval $compile; then
  750.   rm -rf conftest*
  751.   have_lib="1"
  752.  
  753. fi
  754. rm -f conftest*
  755. LIBS="${LIBS_save}"
  756. if test -n "${have_lib}"; then
  757.    :; CMDLIBS="$CMDLIBS -ltermcap"
  758. else
  759.    :; 
  760. fi
  761.  
  762. fi
  763.  
  764.  
  765.  
  766. # check whether --with-FLIBS was given
  767. withval="$with_FLIBS"
  768. if test -n "$withval"; then
  769.    
  770.   echo "look for F2C LIBS in $withval"
  771.   LIBS="$LIBS -L$withval"
  772.   FLIB_DIR="-L$withval"
  773.  
  774. else
  775.   
  776.   FLIB_DIR=""
  777.  
  778. fi
  779.  
  780.  
  781. LIBS_save="${LIBS}"
  782. LIBS="${LIBS} -lf2c"
  783. have_lib=""
  784. echo checking for -lf2c
  785. cat > conftest.c <<EOF
  786. #include "confdefs.h"
  787.  
  788. int main() { exit(0); }
  789. int t() { main(); }
  790. EOF
  791. if eval $compile; then
  792.   rm -rf conftest*
  793.   have_lib="1"
  794.  
  795. fi
  796. rm -f conftest*
  797. LIBS="${LIBS_save}"
  798. if test -n "${have_lib}"; then
  799.    :; FLIBS="$FLIB_DIR -lf2c"
  800. else
  801.    :; 
  802. fi
  803.  
  804.  
  805. if test -z "$FLIBS" ; then
  806.    LIBS_save="${LIBS}"
  807. LIBS="${LIBS} -lF77"
  808. have_lib=""
  809. echo checking for -lF77
  810. cat > conftest.c <<EOF
  811. #include "confdefs.h"
  812.  
  813. int main() { exit(0); }
  814. int t() { main(); }
  815. EOF
  816. if eval $compile; then
  817.   rm -rf conftest*
  818.   have_lib="1"
  819.  
  820. fi
  821. rm -f conftest*
  822. LIBS="${LIBS_save}"
  823. if test -n "${have_lib}"; then
  824.    :; FLIBS="$FLIB_DIR -lF77"
  825. else
  826.    :; 
  827. fi
  828.  
  829.     LIBS_save="${LIBS}"
  830. LIBS="${LIBS} -lI77"
  831. have_lib=""
  832. echo checking for -lI77
  833. cat > conftest.c <<EOF
  834. #include "confdefs.h"
  835.  
  836. int main() { exit(0); }
  837. int t() { main(); }
  838. EOF
  839. if eval $compile; then
  840.   rm -rf conftest*
  841.   have_lib="1"
  842.  
  843. fi
  844. rm -f conftest*
  845. LIBS="${LIBS_save}"
  846. if test -n "${have_lib}"; then
  847.    :; FLIBS="$FLIBS -lI77"
  848. else
  849.    :; 
  850. fi
  851.  
  852.     if test -z "$FLIBS" ; then
  853.       echo "WARNING: Cannot find Fortran libraries,  use --with-FLIBS option"
  854.     fi 
  855. fi
  856.  
  857.  
  858.  
  859.  
  860. X11LIB="-lX11"
  861.  
  862.  
  863. LIBS_save="${LIBS}"
  864. LIBS="${LIBS} -lnsl"
  865. have_lib=""
  866. echo checking for -lnsl
  867. cat > conftest.c <<EOF
  868. #include "confdefs.h"
  869.  
  870. int main() { exit(0); }
  871. int t() { main(); }
  872. EOF
  873. if eval $compile; then
  874.   rm -rf conftest*
  875.   have_lib="1"
  876.  
  877. fi
  878. rm -f conftest*
  879. LIBS="${LIBS_save}"
  880. if test -n "${have_lib}"; then
  881.    :; NSL=true
  882. else
  883.    :; 
  884. fi
  885.  
  886.  
  887. if test -n "$NSL" ; then
  888.   LIBS="$LIBS -lnsl"
  889.  
  890.   LIBS_save="${LIBS}"
  891. LIBS="${LIBS} -lsocket"
  892. have_lib=""
  893. echo checking for -lsocket
  894. cat > conftest.c <<EOF
  895. #include "confdefs.h"
  896.  
  897. int main() { exit(0); }
  898. int t() { main(); }
  899. EOF
  900. if eval $compile; then
  901.   rm -rf conftest*
  902.   have_lib="1"
  903.  
  904. fi
  905. rm -f conftest*
  906. LIBS="${LIBS_save}"
  907. if test -n "${have_lib}"; then
  908.    :; X11LIB="$X11LIB -lsocket -lnsl"
  909. else
  910.    :; 
  911. fi
  912.  
  913.  
  914. fi
  915.  
  916.  
  917. # check whether --with-PLIBS was given
  918. withval="$with_PLIBS"
  919. if test -n "$withval"; then
  920.    
  921.   echo "look for PLPLOT library $withval"
  922.   LIBS="$LIBS -L$withval"
  923.   PLIB_DIR="-L$withval"
  924.   PLIB_INC="$withval"
  925.  
  926. else
  927.   
  928.   LIBS="$LIBS -L/usr/local/plplot"
  929.   PLIB_DIR="-L/usr/local/plplot"
  930.   PLIB_INC="/usr/local/plplot"
  931.  
  932. fi
  933.  
  934.  
  935. LIBS_save="${LIBS}"
  936. LIBS="${LIBS} -lplplotdX"
  937. have_lib=""
  938. echo checking for -lplplotdX
  939. cat > conftest.c <<EOF
  940. #include "confdefs.h"
  941.  
  942. int main() { exit(0); }
  943. int t() { main(); }
  944. EOF
  945. if eval $compile; then
  946.   rm -rf conftest*
  947.   have_lib="1"
  948.  
  949. fi
  950. rm -f conftest*
  951. LIBS="${LIBS_save}"
  952. if test -n "${have_lib}"; then
  953.    :; PLIBS="$PLIB_DIR -lplplotdX $X11LIB"
  954. else
  955.    :; 
  956. fi
  957.  
  958.  
  959. if test -z "$PLIBS" ; then
  960.    LIBS_save="${LIBS}"
  961. LIBS="${LIBS} -lplplotdtk"
  962. have_lib=""
  963. echo checking for -lplplotdtk
  964. cat > conftest.c <<EOF
  965. #include "confdefs.h"
  966.  
  967. int main() { exit(0); }
  968. int t() { main(); }
  969. EOF
  970. if eval $compile; then
  971.   rm -rf conftest*
  972.   have_lib="1"
  973.  
  974. fi
  975. rm -f conftest*
  976. LIBS="${LIBS_save}"
  977. if test -n "${have_lib}"; then
  978.    :; PLIBS="$PLIB_DIR -lplplotdtk -ltk -ltcl $X11LIB"
  979. else
  980.    :; 
  981. fi
  982.  
  983. fi
  984.  
  985.  
  986.  
  987. if test -n "$PLIBS" ; then
  988.    
  989. {
  990. test -n "$verbose" && \
  991. echo "    defining" HAVE_RLAB_PLPLOT to be 1
  992. echo "#define" HAVE_RLAB_PLPLOT 1 >> confdefs.h
  993. DEFS="$DEFS -DHAVE_RLAB_PLPLOT=1"
  994. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_RLAB_PLPLOT\${SEDdB}HAVE_RLAB_PLPLOT\${SEDdC}1\${SEDdD}
  995. \${SEDuA}HAVE_RLAB_PLPLOT\${SEDuB}HAVE_RLAB_PLPLOT\${SEDuC}1\${SEDuD}
  996. \${SEDeA}HAVE_RLAB_PLPLOT\${SEDeB}HAVE_RLAB_PLPLOT\${SEDeC}1\${SEDeD}
  997. "
  998. }
  999.  
  1000.     PLOT_PROG="plplot"
  1001.     PLIB_INC_DIR="-I$PLIB_INC/include"
  1002.   else
  1003.    if test -z "$PLOT_PROG"; then
  1004.   # Extract the first word of `gnuplot', so it can be a program name with args.
  1005.   set dummy gnuplot; word=$2
  1006.   echo checking for $word
  1007.   IFS="${IFS=     }"; saveifs="$IFS"; IFS="${IFS}:"
  1008.   for dir in $PATH; do
  1009.     test -z "$dir" && dir=.
  1010.     if test -f $dir/$word; then
  1011.       PLOT_PROG="gnuplot"
  1012.       break
  1013.     fi
  1014.   done
  1015.   IFS="$saveifs"
  1016. fi
  1017. test -z "$PLOT_PROG" && PLOT_PROG="nothing"
  1018. test -n "$PLOT_PROG" && test -n "$verbose" && echo "    setting PLOT_PROG to $PLOT_PROG"
  1019.  
  1020.     PLIB_INC_DIR=""
  1021. fi
  1022.  
  1023.  
  1024.  
  1025. if test -z "$TITAN" ; then
  1026.  echo checking for ANSI C header files
  1027. cat > conftest.c <<EOF
  1028. #include "confdefs.h"
  1029. #include <stdlib.h>
  1030. #include <stdarg.h>
  1031. #include <string.h>
  1032. #include <float.h>
  1033. EOF
  1034. err=`eval "($CPP conftest.c >/dev/null) 2>&1"`
  1035. if test -z "$err"; then
  1036.   rm -rf conftest*
  1037.   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
  1038. echo '#include "confdefs.h"
  1039. #include <string.h>' > conftest.c
  1040. eval "$CPP conftest.c > conftest.out 2>&1"
  1041. if egrep "memchr" conftest.out >/dev/null 2>&1; then
  1042.   rm -rf conftest*
  1043.   # SGI's /bin/cc from Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
  1044. cat > conftest.c <<EOF
  1045. #include "confdefs.h"
  1046. #include <ctype.h>
  1047. #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
  1048. #define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
  1049. #define XOR(e,f) (((e) && !(f)) || (!(e) && (f)))
  1050. int main () { int i; for (i = 0; i < 256; i++)
  1051. if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
  1052. exit (0); }
  1053.  
  1054. EOF
  1055. eval $compile
  1056. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  1057.   
  1058. {
  1059. test -n "$verbose" && \
  1060. echo "    defining STDC_HEADERS"
  1061. echo "#define" STDC_HEADERS 1 >> confdefs.h
  1062. DEFS="$DEFS -DSTDC_HEADERS=1"
  1063. SEDDEFS="${SEDDEFS}\${SEDdA}STDC_HEADERS\${SEDdB}STDC_HEADERS\${SEDdC}1\${SEDdD}
  1064. \${SEDuA}STDC_HEADERS\${SEDuB}STDC_HEADERS\${SEDuC}1\${SEDuD}
  1065. \${SEDeA}STDC_HEADERS\${SEDeB}STDC_HEADERS\${SEDeC}1\${SEDeD}
  1066. "
  1067. }
  1068.  
  1069.  
  1070. fi
  1071. rm -fr conftest*
  1072.  
  1073. fi
  1074. rm -f conftest*
  1075.  
  1076.  
  1077. fi
  1078. rm -f conftest*
  1079.  
  1080.   echo checking for directory library header
  1081. dirheader=
  1082. if test -z "$dirheader"; then
  1083.   echo checking for dirent.h
  1084. cat > conftest.c <<EOF
  1085. #include "confdefs.h"
  1086. #include <sys/types.h>
  1087. #include <dirent.h>
  1088. int main() { exit(0); }
  1089. int t() { DIR *dirp = 0; }
  1090. EOF
  1091. if eval $compile; then
  1092.   rm -rf conftest*
  1093.   
  1094. {
  1095. test -n "$verbose" && \
  1096. echo "    defining DIRENT"
  1097. echo "#define" DIRENT 1 >> confdefs.h
  1098. DEFS="$DEFS -DDIRENT=1"
  1099. SEDDEFS="${SEDDEFS}\${SEDdA}DIRENT\${SEDdB}DIRENT\${SEDdC}1\${SEDdD}
  1100. \${SEDuA}DIRENT\${SEDuB}DIRENT\${SEDuC}1\${SEDuD}
  1101. \${SEDeA}DIRENT\${SEDeB}DIRENT\${SEDeC}1\${SEDeD}
  1102. "
  1103. }
  1104.  dirheader=dirent.h
  1105.  
  1106. fi
  1107. rm -f conftest*
  1108. fi
  1109. if test -z "$dirheader"; then
  1110.   echo checking for sys/ndir.h
  1111. cat > conftest.c <<EOF
  1112. #include "confdefs.h"
  1113. #include <sys/types.h>
  1114. #include <sys/ndir.h>
  1115. int main() { exit(0); }
  1116. int t() { DIR *dirp = 0; }
  1117. EOF
  1118. if eval $compile; then
  1119.   rm -rf conftest*
  1120.   
  1121. {
  1122. test -n "$verbose" && \
  1123. echo "    defining SYSNDIR"
  1124. echo "#define" SYSNDIR 1 >> confdefs.h
  1125. DEFS="$DEFS -DSYSNDIR=1"
  1126. SEDDEFS="${SEDDEFS}\${SEDdA}SYSNDIR\${SEDdB}SYSNDIR\${SEDdC}1\${SEDdD}
  1127. \${SEDuA}SYSNDIR\${SEDuB}SYSNDIR\${SEDuC}1\${SEDuD}
  1128. \${SEDeA}SYSNDIR\${SEDeB}SYSNDIR\${SEDeC}1\${SEDeD}
  1129. "
  1130. }
  1131.  dirheader=sys/ndir.h
  1132.  
  1133. fi
  1134. rm -f conftest*
  1135. fi
  1136. if test -z "$dirheader"; then
  1137.   echo checking for sys/dir.h
  1138. cat > conftest.c <<EOF
  1139. #include "confdefs.h"
  1140. #include <sys/types.h>
  1141. #include <sys/dir.h>
  1142. int main() { exit(0); }
  1143. int t() { DIR *dirp = 0; }
  1144. EOF
  1145. if eval $compile; then
  1146.   rm -rf conftest*
  1147.   
  1148. {
  1149. test -n "$verbose" && \
  1150. echo "    defining SYSDIR"
  1151. echo "#define" SYSDIR 1 >> confdefs.h
  1152. DEFS="$DEFS -DSYSDIR=1"
  1153. SEDDEFS="${SEDDEFS}\${SEDdA}SYSDIR\${SEDdB}SYSDIR\${SEDdC}1\${SEDdD}
  1154. \${SEDuA}SYSDIR\${SEDuB}SYSDIR\${SEDuC}1\${SEDuD}
  1155. \${SEDeA}SYSDIR\${SEDeB}SYSDIR\${SEDeC}1\${SEDeD}
  1156. "
  1157. }
  1158.  dirheader=sys/dir.h
  1159.  
  1160. fi
  1161. rm -f conftest*
  1162. fi
  1163. if test -z "$dirheader"; then
  1164.   echo checking for ndir.h
  1165. cat > conftest.c <<EOF
  1166. #include "confdefs.h"
  1167. #include <sys/types.h>
  1168. #include <ndir.h>
  1169. int main() { exit(0); }
  1170. int t() { DIR *dirp = 0; }
  1171. EOF
  1172. if eval $compile; then
  1173.   rm -rf conftest*
  1174.   
  1175. {
  1176. test -n "$verbose" && \
  1177. echo "    defining NDIR"
  1178. echo "#define" NDIR 1 >> confdefs.h
  1179. DEFS="$DEFS -DNDIR=1"
  1180. SEDDEFS="${SEDDEFS}\${SEDdA}NDIR\${SEDdB}NDIR\${SEDdC}1\${SEDdD}
  1181. \${SEDuA}NDIR\${SEDuB}NDIR\${SEDuC}1\${SEDuD}
  1182. \${SEDeA}NDIR\${SEDeB}NDIR\${SEDeC}1\${SEDeD}
  1183. "
  1184. }
  1185.  dirheader=ndir.h
  1186.  
  1187. fi
  1188. rm -f conftest*
  1189. fi
  1190.  
  1191. echo checking for closedir return value
  1192. cat > conftest.c <<EOF
  1193. #include "confdefs.h"
  1194. #include <sys/types.h>
  1195. #include <$dirheader>
  1196. int closedir(); main() { exit(closedir(opendir(".")) != 0); }
  1197. EOF
  1198. eval $compile
  1199. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  1200.   :
  1201. else
  1202.   
  1203. {
  1204. test -n "$verbose" && \
  1205. echo "    defining VOID_CLOSEDIR"
  1206. echo "#define" VOID_CLOSEDIR 1 >> confdefs.h
  1207. DEFS="$DEFS -DVOID_CLOSEDIR=1"
  1208. SEDDEFS="${SEDDEFS}\${SEDdA}VOID_CLOSEDIR\${SEDdB}VOID_CLOSEDIR\${SEDdC}1\${SEDdD}
  1209. \${SEDuA}VOID_CLOSEDIR\${SEDuB}VOID_CLOSEDIR\${SEDuC}1\${SEDuD}
  1210. \${SEDeA}VOID_CLOSEDIR\${SEDeB}VOID_CLOSEDIR\${SEDeC}1\${SEDeD}
  1211. "
  1212. }
  1213.  
  1214. fi
  1215. rm -fr conftest*
  1216.  
  1217.   for hdr in stdlib.h time.h float.h ieeefp.h unistd.h
  1218. do
  1219. trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'`
  1220. echo checking for ${hdr}
  1221. cat > conftest.c <<EOF
  1222. #include "confdefs.h"
  1223. #include <${hdr}>
  1224. EOF
  1225. err=`eval "($CPP conftest.c >/dev/null) 2>&1"`
  1226. if test -z "$err"; then
  1227.   rm -rf conftest*
  1228.   
  1229. {
  1230. test -n "$verbose" && \
  1231. echo "    defining ${trhdr}"
  1232. echo "#define" ${trhdr} 1 >> confdefs.h
  1233. DEFS="$DEFS -D${trhdr}=1"
  1234. SEDDEFS="${SEDDEFS}\${SEDdA}${trhdr}\${SEDdB}${trhdr}\${SEDdC}1\${SEDdD}
  1235. \${SEDuA}${trhdr}\${SEDuB}${trhdr}\${SEDuC}1\${SEDuD}
  1236. \${SEDeA}${trhdr}\${SEDeB}${trhdr}\${SEDeC}1\${SEDeD}
  1237. "
  1238. }
  1239.  
  1240.  
  1241. fi
  1242. rm -f conftest*
  1243. done
  1244.  
  1245.     LIBS_save="${LIBS}"
  1246. LIBS="${LIBS} -lm"
  1247. have_lib=""
  1248. echo checking for -lm
  1249. cat > conftest.c <<EOF
  1250. #include "confdefs.h"
  1251.  
  1252. int main() { exit(0); }
  1253. int t() { main(); }
  1254. EOF
  1255. if eval $compile; then
  1256.   rm -rf conftest*
  1257.   have_lib="1"
  1258.  
  1259. fi
  1260. rm -f conftest*
  1261. LIBS="${LIBS_save}"
  1262. if test -n "${have_lib}"; then
  1263.    
  1264. {
  1265. test -n "$verbose" && \
  1266. echo "    defining HAVE_LIBM"
  1267. echo "#define" HAVE_LIBM 1 >> confdefs.h
  1268. DEFS="$DEFS -DHAVE_LIBM=1"
  1269. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_LIBM\${SEDdB}HAVE_LIBM\${SEDdC}1\${SEDdD}
  1270. \${SEDuA}HAVE_LIBM\${SEDuB}HAVE_LIBM\${SEDuC}1\${SEDuD}
  1271. \${SEDeA}HAVE_LIBM\${SEDeB}HAVE_LIBM\${SEDeC}1\${SEDeD}
  1272. "
  1273. }
  1274.  
  1275.    LIBS="${LIBS} -lm"
  1276. fi
  1277.  
  1278.   for func in difftime rint rindex matherr fpsetmask
  1279. do
  1280. trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'`
  1281. echo checking for ${func}
  1282. cat > conftest.c <<EOF
  1283. #include "confdefs.h"
  1284. #include <ctype.h>
  1285. int main() { exit(0); }
  1286. int t() { 
  1287. /* The GNU C library defines this for functions which it implements
  1288.     to always fail with ENOSYS.  Some functions are actually named
  1289.     something starting with __ and the normal name is an alias.  */
  1290. #if defined (__stub_${func}) || defined (__stub___${func})
  1291. choke me
  1292. #else
  1293. /* Override any gcc2 internal prototype to avoid an error.  */
  1294. extern char ${func}(); ${func}();
  1295. #endif
  1296.  }
  1297. EOF
  1298. if eval $compile; then
  1299.   rm -rf conftest*
  1300.   {
  1301. test -n "$verbose" && \
  1302. echo "    defining ${trfunc}"
  1303. echo "#define" ${trfunc} 1 >> confdefs.h
  1304. DEFS="$DEFS -D${trfunc}=1"
  1305. SEDDEFS="${SEDDEFS}\${SEDdA}${trfunc}\${SEDdB}${trfunc}\${SEDdC}1\${SEDdD}
  1306. \${SEDuA}${trfunc}\${SEDuB}${trfunc}\${SEDuC}1\${SEDuD}
  1307. \${SEDeA}${trfunc}\${SEDeB}${trfunc}\${SEDeC}1\${SEDeD}
  1308. "
  1309. }
  1310.  
  1311.  
  1312. fi
  1313. rm -f conftest*
  1314. done
  1315.  
  1316.   # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
  1317. # for constant arguments.  Useless!
  1318. echo checking for working alloca.h
  1319. cat > conftest.c <<EOF
  1320. #include "confdefs.h"
  1321. #include <alloca.h>
  1322. int main() { exit(0); }
  1323. int t() { char *p = alloca(2 * sizeof(int)); }
  1324. EOF
  1325. if eval $compile; then
  1326.   rm -rf conftest*
  1327.   
  1328. {
  1329. test -n "$verbose" && \
  1330. echo "    defining HAVE_ALLOCA_H"
  1331. echo "#define" HAVE_ALLOCA_H 1 >> confdefs.h
  1332. DEFS="$DEFS -DHAVE_ALLOCA_H=1"
  1333. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_ALLOCA_H\${SEDdB}HAVE_ALLOCA_H\${SEDdC}1\${SEDdD}
  1334. \${SEDuA}HAVE_ALLOCA_H\${SEDuB}HAVE_ALLOCA_H\${SEDuC}1\${SEDuD}
  1335. \${SEDeA}HAVE_ALLOCA_H\${SEDeB}HAVE_ALLOCA_H\${SEDeC}1\${SEDeD}
  1336. "
  1337. }
  1338.  
  1339.  
  1340. fi
  1341. rm -f conftest*
  1342.  
  1343. decl="#ifdef __GNUC__
  1344. #define alloca __builtin_alloca
  1345. #else
  1346. #if HAVE_ALLOCA_H
  1347. #include <alloca.h>
  1348. #else
  1349. #ifdef _AIX
  1350.  #pragma alloca
  1351. #else
  1352. char *alloca ();
  1353. #endif
  1354. #endif
  1355. #endif
  1356. "
  1357. echo checking for alloca
  1358. cat > conftest.c <<EOF
  1359. #include "confdefs.h"
  1360. $decl
  1361. int main() { exit(0); }
  1362. int t() { char *p = (char *) alloca(1); }
  1363. EOF
  1364. if eval $compile; then
  1365.   :
  1366. else
  1367.   rm -rf conftest*
  1368.   alloca_missing=1
  1369. cat > conftest.c <<EOF
  1370. #include "confdefs.h"
  1371.  
  1372. #if defined(CRAY) && ! defined(CRAY2)
  1373. winnitude
  1374. #else
  1375. lossage
  1376. #endif
  1377.  
  1378. EOF
  1379. eval "$CPP conftest.c > conftest.out 2>&1"
  1380. if egrep "winnitude" conftest.out >/dev/null 2>&1; then
  1381.   rm -rf conftest*
  1382.   echo checking for _getb67
  1383. cat > conftest.c <<EOF
  1384. #include "confdefs.h"
  1385. #include <ctype.h>
  1386. int main() { exit(0); }
  1387. int t() { 
  1388. /* The GNU C library defines this for functions which it implements
  1389.     to always fail with ENOSYS.  Some functions are actually named
  1390.     something starting with __ and the normal name is an alias.  */
  1391. #if defined (__stub__getb67) || defined (__stub____getb67)
  1392. choke me
  1393. #else
  1394. /* Override any gcc2 internal prototype to avoid an error.  */
  1395. extern char _getb67(); _getb67();
  1396. #endif
  1397.  }
  1398. EOF
  1399. if eval $compile; then
  1400.   rm -rf conftest*
  1401.   {
  1402. test -n "$verbose" && \
  1403. echo "    defining" CRAY_STACKSEG_END to be _getb67
  1404. echo "#define" CRAY_STACKSEG_END _getb67 >> confdefs.h
  1405. DEFS="$DEFS -DCRAY_STACKSEG_END=_getb67"
  1406. SEDDEFS="${SEDDEFS}\${SEDdA}CRAY_STACKSEG_END\${SEDdB}CRAY_STACKSEG_END\${SEDdC}_getb67\${SEDdD}
  1407. \${SEDuA}CRAY_STACKSEG_END\${SEDuB}CRAY_STACKSEG_END\${SEDuC}_getb67\${SEDuD}
  1408. \${SEDeA}CRAY_STACKSEG_END\${SEDeB}CRAY_STACKSEG_END\${SEDeC}_getb67\${SEDeD}
  1409. "
  1410. }
  1411.  
  1412.  
  1413. else
  1414.   rm -rf conftest*
  1415.   echo checking for GETB67
  1416. cat > conftest.c <<EOF
  1417. #include "confdefs.h"
  1418. #include <ctype.h>
  1419. int main() { exit(0); }
  1420. int t() { 
  1421. /* The GNU C library defines this for functions which it implements
  1422.     to always fail with ENOSYS.  Some functions are actually named
  1423.     something starting with __ and the normal name is an alias.  */
  1424. #if defined (__stub_GETB67) || defined (__stub___GETB67)
  1425. choke me
  1426. #else
  1427. /* Override any gcc2 internal prototype to avoid an error.  */
  1428. extern char GETB67(); GETB67();
  1429. #endif
  1430.  }
  1431. EOF
  1432. if eval $compile; then
  1433.   rm -rf conftest*
  1434.   {
  1435. test -n "$verbose" && \
  1436. echo "    defining" CRAY_STACKSEG_END to be GETB67
  1437. echo "#define" CRAY_STACKSEG_END GETB67 >> confdefs.h
  1438. DEFS="$DEFS -DCRAY_STACKSEG_END=GETB67"
  1439. SEDDEFS="${SEDDEFS}\${SEDdA}CRAY_STACKSEG_END\${SEDdB}CRAY_STACKSEG_END\${SEDdC}GETB67\${SEDdD}
  1440. \${SEDuA}CRAY_STACKSEG_END\${SEDuB}CRAY_STACKSEG_END\${SEDuC}GETB67\${SEDuD}
  1441. \${SEDeA}CRAY_STACKSEG_END\${SEDeB}CRAY_STACKSEG_END\${SEDeC}GETB67\${SEDeD}
  1442. "
  1443. }
  1444.  
  1445.  
  1446. else
  1447.   rm -rf conftest*
  1448.   echo checking for getb67
  1449. cat > conftest.c <<EOF
  1450. #include "confdefs.h"
  1451. #include <ctype.h>
  1452. int main() { exit(0); }
  1453. int t() { 
  1454. /* The GNU C library defines this for functions which it implements
  1455.     to always fail with ENOSYS.  Some functions are actually named
  1456.     something starting with __ and the normal name is an alias.  */
  1457. #if defined (__stub_getb67) || defined (__stub___getb67)
  1458. choke me
  1459. #else
  1460. /* Override any gcc2 internal prototype to avoid an error.  */
  1461. extern char getb67(); getb67();
  1462. #endif
  1463.  }
  1464. EOF
  1465. if eval $compile; then
  1466.   rm -rf conftest*
  1467.   {
  1468. test -n "$verbose" && \
  1469. echo "    defining" CRAY_STACKSEG_END to be getb67
  1470. echo "#define" CRAY_STACKSEG_END getb67 >> confdefs.h
  1471. DEFS="$DEFS -DCRAY_STACKSEG_END=getb67"
  1472. SEDDEFS="${SEDDEFS}\${SEDdA}CRAY_STACKSEG_END\${SEDdB}CRAY_STACKSEG_END\${SEDdC}getb67\${SEDdD}
  1473. \${SEDuA}CRAY_STACKSEG_END\${SEDuB}CRAY_STACKSEG_END\${SEDuC}getb67\${SEDuD}
  1474. \${SEDeA}CRAY_STACKSEG_END\${SEDeB}CRAY_STACKSEG_END\${SEDeC}getb67\${SEDeD}
  1475. "
  1476. }
  1477.  
  1478.  
  1479. fi
  1480. rm -f conftest*
  1481.  
  1482. fi
  1483. rm -f conftest*
  1484.  
  1485. fi
  1486. rm -f conftest*
  1487.  
  1488.  
  1489. fi
  1490. rm -f conftest*
  1491.  
  1492.  
  1493. fi
  1494. rm -f conftest*
  1495.  
  1496. if test -n "$alloca_missing"; then
  1497.   # The SVR3 libPW and SVR4 libucb both contain incompatible functions
  1498.   # that cause trouble.  Some versions do not even contain alloca or
  1499.   # contain a buggy version.  If you still want to use their alloca,
  1500.   # use ar to extract alloca.o from them instead of compiling alloca.c.
  1501.   ALLOCA=alloca.o
  1502.   
  1503. {
  1504. test -n "$verbose" && \
  1505. echo "    defining C_ALLOCA"
  1506. echo "#define" C_ALLOCA 1 >> confdefs.h
  1507. DEFS="$DEFS -DC_ALLOCA=1"
  1508. SEDDEFS="${SEDDEFS}\${SEDdA}C_ALLOCA\${SEDdB}C_ALLOCA\${SEDdC}1\${SEDdD}
  1509. \${SEDuA}C_ALLOCA\${SEDuB}C_ALLOCA\${SEDuC}1\${SEDuD}
  1510. \${SEDeA}C_ALLOCA\${SEDeB}C_ALLOCA\${SEDeC}1\${SEDeD}
  1511. "
  1512. }
  1513.  
  1514.  
  1515.   echo 'checking stack direction for C alloca'
  1516.   echo checking whether cross-compiling
  1517. # If we cannot run a trivial program, we must be cross compiling.
  1518. cat > conftest.c <<EOF
  1519. #include "confdefs.h"
  1520. main(){exit(0);}
  1521. EOF
  1522. eval $compile
  1523. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  1524.   :
  1525. else
  1526.   cross_compiling=1
  1527. fi
  1528. rm -fr conftest*
  1529.  
  1530. if test -n "$cross_compiling"
  1531. then
  1532.   
  1533. {
  1534. test -n "$verbose" && \
  1535. echo "    defining" STACK_DIRECTION to be 0
  1536. echo "#define" STACK_DIRECTION 0 >> confdefs.h
  1537. DEFS="$DEFS -DSTACK_DIRECTION=0"
  1538. SEDDEFS="${SEDDEFS}\${SEDdA}STACK_DIRECTION\${SEDdB}STACK_DIRECTION\${SEDdC}0\${SEDdD}
  1539. \${SEDuA}STACK_DIRECTION\${SEDuB}STACK_DIRECTION\${SEDuC}0\${SEDuD}
  1540. \${SEDeA}STACK_DIRECTION\${SEDeB}STACK_DIRECTION\${SEDeC}0\${SEDeD}
  1541. "
  1542. }
  1543.  
  1544. else
  1545. cat > conftest.c <<EOF
  1546. #include "confdefs.h"
  1547. find_stack_direction ()
  1548. {
  1549.   static char *addr = 0;
  1550.   auto char dummy;
  1551.   if (addr == 0)
  1552.     {
  1553.       addr = &dummy;
  1554.       return find_stack_direction ();
  1555.     }
  1556.   else
  1557.     return (&dummy > addr) ? 1 : -1;
  1558. }
  1559. main ()
  1560. {
  1561.   exit (find_stack_direction() < 0);
  1562. }
  1563. EOF
  1564. eval $compile
  1565. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  1566.   
  1567. {
  1568. test -n "$verbose" && \
  1569. echo "    defining" STACK_DIRECTION to be 1
  1570. echo "#define" STACK_DIRECTION 1 >> confdefs.h
  1571. DEFS="$DEFS -DSTACK_DIRECTION=1"
  1572. SEDDEFS="${SEDDEFS}\${SEDdA}STACK_DIRECTION\${SEDdB}STACK_DIRECTION\${SEDdC}1\${SEDdD}
  1573. \${SEDuA}STACK_DIRECTION\${SEDuB}STACK_DIRECTION\${SEDuC}1\${SEDuD}
  1574. \${SEDeA}STACK_DIRECTION\${SEDeB}STACK_DIRECTION\${SEDeC}1\${SEDeD}
  1575. "
  1576. }
  1577.  
  1578.  
  1579. else
  1580.   
  1581. {
  1582. test -n "$verbose" && \
  1583. echo "    defining" STACK_DIRECTION to be -1
  1584. echo "#define" STACK_DIRECTION -1 >> confdefs.h
  1585. DEFS="$DEFS -DSTACK_DIRECTION=-1"
  1586. SEDDEFS="${SEDDEFS}\${SEDdA}STACK_DIRECTION\${SEDdB}STACK_DIRECTION\${SEDdC}-1\${SEDdD}
  1587. \${SEDuA}STACK_DIRECTION\${SEDuB}STACK_DIRECTION\${SEDuC}-1\${SEDuD}
  1588. \${SEDeA}STACK_DIRECTION\${SEDeB}STACK_DIRECTION\${SEDeC}-1\${SEDeD}
  1589. "
  1590. }
  1591.  
  1592. fi
  1593. fi
  1594. rm -fr conftest*
  1595. fi
  1596.  
  1597.   echo '#include "confdefs.h"
  1598. #include <math.h>' > conftest.c
  1599. eval "$CPP conftest.c > conftest.out 2>&1"
  1600. if egrep " rint" conftest.out >/dev/null 2>&1; then
  1601.   rm -rf conftest*
  1602.   
  1603. {
  1604. test -n "$verbose" && \
  1605. echo "    defining" HAVE_RINT_DEC to be 1
  1606. echo "#define" HAVE_RINT_DEC 1 >> confdefs.h
  1607. DEFS="$DEFS -DHAVE_RINT_DEC=1"
  1608. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_RINT_DEC\${SEDdB}HAVE_RINT_DEC\${SEDdC}1\${SEDdD}
  1609. \${SEDuA}HAVE_RINT_DEC\${SEDuB}HAVE_RINT_DEC\${SEDuC}1\${SEDuD}
  1610. \${SEDeA}HAVE_RINT_DEC\${SEDeB}HAVE_RINT_DEC\${SEDeC}1\${SEDeD}
  1611. "
  1612. }
  1613.  
  1614.  
  1615. fi
  1616. rm -f conftest*
  1617.  
  1618.  
  1619. else
  1620.    
  1621. {
  1622. test -n "$verbose" && \
  1623. echo "    defining" TITAN to be 1
  1624. echo "#define" TITAN 1 >> confdefs.h
  1625. DEFS="$DEFS -DTITAN=1"
  1626. SEDDEFS="${SEDDEFS}\${SEDdA}TITAN\${SEDdB}TITAN\${SEDdC}1\${SEDdD}
  1627. \${SEDuA}TITAN\${SEDuB}TITAN\${SEDuC}1\${SEDuD}
  1628. \${SEDeA}TITAN\${SEDeB}TITAN\${SEDeC}1\${SEDeD}
  1629. "
  1630. }
  1631.  
  1632.   echo checking for directory library header
  1633. dirheader=
  1634. if test -z "$dirheader"; then
  1635.   echo checking for dirent.h
  1636. cat > conftest.c <<EOF
  1637. #include "confdefs.h"
  1638. #include <sys/types.h>
  1639. #include <dirent.h>
  1640. int main() { exit(0); }
  1641. int t() { DIR *dirp = 0; }
  1642. EOF
  1643. if eval $compile; then
  1644.   rm -rf conftest*
  1645.   
  1646. {
  1647. test -n "$verbose" && \
  1648. echo "    defining DIRENT"
  1649. echo "#define" DIRENT 1 >> confdefs.h
  1650. DEFS="$DEFS -DDIRENT=1"
  1651. SEDDEFS="${SEDDEFS}\${SEDdA}DIRENT\${SEDdB}DIRENT\${SEDdC}1\${SEDdD}
  1652. \${SEDuA}DIRENT\${SEDuB}DIRENT\${SEDuC}1\${SEDuD}
  1653. \${SEDeA}DIRENT\${SEDeB}DIRENT\${SEDeC}1\${SEDeD}
  1654. "
  1655. }
  1656.  dirheader=dirent.h
  1657.  
  1658. fi
  1659. rm -f conftest*
  1660. fi
  1661. if test -z "$dirheader"; then
  1662.   echo checking for sys/ndir.h
  1663. cat > conftest.c <<EOF
  1664. #include "confdefs.h"
  1665. #include <sys/types.h>
  1666. #include <sys/ndir.h>
  1667. int main() { exit(0); }
  1668. int t() { DIR *dirp = 0; }
  1669. EOF
  1670. if eval $compile; then
  1671.   rm -rf conftest*
  1672.   
  1673. {
  1674. test -n "$verbose" && \
  1675. echo "    defining SYSNDIR"
  1676. echo "#define" SYSNDIR 1 >> confdefs.h
  1677. DEFS="$DEFS -DSYSNDIR=1"
  1678. SEDDEFS="${SEDDEFS}\${SEDdA}SYSNDIR\${SEDdB}SYSNDIR\${SEDdC}1\${SEDdD}
  1679. \${SEDuA}SYSNDIR\${SEDuB}SYSNDIR\${SEDuC}1\${SEDuD}
  1680. \${SEDeA}SYSNDIR\${SEDeB}SYSNDIR\${SEDeC}1\${SEDeD}
  1681. "
  1682. }
  1683.  dirheader=sys/ndir.h
  1684.  
  1685. fi
  1686. rm -f conftest*
  1687. fi
  1688. if test -z "$dirheader"; then
  1689.   echo checking for sys/dir.h
  1690. cat > conftest.c <<EOF
  1691. #include "confdefs.h"
  1692. #include <sys/types.h>
  1693. #include <sys/dir.h>
  1694. int main() { exit(0); }
  1695. int t() { DIR *dirp = 0; }
  1696. EOF
  1697. if eval $compile; then
  1698.   rm -rf conftest*
  1699.   
  1700. {
  1701. test -n "$verbose" && \
  1702. echo "    defining SYSDIR"
  1703. echo "#define" SYSDIR 1 >> confdefs.h
  1704. DEFS="$DEFS -DSYSDIR=1"
  1705. SEDDEFS="${SEDDEFS}\${SEDdA}SYSDIR\${SEDdB}SYSDIR\${SEDdC}1\${SEDdD}
  1706. \${SEDuA}SYSDIR\${SEDuB}SYSDIR\${SEDuC}1\${SEDuD}
  1707. \${SEDeA}SYSDIR\${SEDeB}SYSDIR\${SEDeC}1\${SEDeD}
  1708. "
  1709. }
  1710.  dirheader=sys/dir.h
  1711.  
  1712. fi
  1713. rm -f conftest*
  1714. fi
  1715. if test -z "$dirheader"; then
  1716.   echo checking for ndir.h
  1717. cat > conftest.c <<EOF
  1718. #include "confdefs.h"
  1719. #include <sys/types.h>
  1720. #include <ndir.h>
  1721. int main() { exit(0); }
  1722. int t() { DIR *dirp = 0; }
  1723. EOF
  1724. if eval $compile; then
  1725.   rm -rf conftest*
  1726.   
  1727. {
  1728. test -n "$verbose" && \
  1729. echo "    defining NDIR"
  1730. echo "#define" NDIR 1 >> confdefs.h
  1731. DEFS="$DEFS -DNDIR=1"
  1732. SEDDEFS="${SEDDEFS}\${SEDdA}NDIR\${SEDdB}NDIR\${SEDdC}1\${SEDdD}
  1733. \${SEDuA}NDIR\${SEDuB}NDIR\${SEDuC}1\${SEDuD}
  1734. \${SEDeA}NDIR\${SEDeB}NDIR\${SEDeC}1\${SEDeD}
  1735. "
  1736. }
  1737.  dirheader=ndir.h
  1738.  
  1739. fi
  1740. rm -f conftest*
  1741. fi
  1742.  
  1743. echo checking for closedir return value
  1744. cat > conftest.c <<EOF
  1745. #include "confdefs.h"
  1746. #include <sys/types.h>
  1747. #include <$dirheader>
  1748. int closedir(); main() { exit(closedir(opendir(".")) != 0); }
  1749. EOF
  1750. eval $compile
  1751. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  1752.   :
  1753. else
  1754.   
  1755. {
  1756. test -n "$verbose" && \
  1757. echo "    defining VOID_CLOSEDIR"
  1758. echo "#define" VOID_CLOSEDIR 1 >> confdefs.h
  1759. DEFS="$DEFS -DVOID_CLOSEDIR=1"
  1760. SEDDEFS="${SEDDEFS}\${SEDdA}VOID_CLOSEDIR\${SEDdB}VOID_CLOSEDIR\${SEDdC}1\${SEDdD}
  1761. \${SEDuA}VOID_CLOSEDIR\${SEDuB}VOID_CLOSEDIR\${SEDuC}1\${SEDuD}
  1762. \${SEDeA}VOID_CLOSEDIR\${SEDeB}VOID_CLOSEDIR\${SEDeC}1\${SEDeD}
  1763. "
  1764. }
  1765.  
  1766. fi
  1767. rm -fr conftest*
  1768.  
  1769.   for hdr in stdlib.h time.h unistd.h
  1770. do
  1771. trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'`
  1772. echo checking for ${hdr}
  1773. cat > conftest.c <<EOF
  1774. #include "confdefs.h"
  1775. #include <${hdr}>
  1776. EOF
  1777. err=`eval "($CPP conftest.c >/dev/null) 2>&1"`
  1778. if test -z "$err"; then
  1779.   rm -rf conftest*
  1780.   
  1781. {
  1782. test -n "$verbose" && \
  1783. echo "    defining ${trhdr}"
  1784. echo "#define" ${trhdr} 1 >> confdefs.h
  1785. DEFS="$DEFS -D${trhdr}=1"
  1786. SEDDEFS="${SEDDEFS}\${SEDdA}${trhdr}\${SEDdB}${trhdr}\${SEDdC}1\${SEDdD}
  1787. \${SEDuA}${trhdr}\${SEDuB}${trhdr}\${SEDuC}1\${SEDuD}
  1788. \${SEDeA}${trhdr}\${SEDeB}${trhdr}\${SEDeC}1\${SEDeD}
  1789. "
  1790. }
  1791.  
  1792.  
  1793. fi
  1794. rm -f conftest*
  1795. done
  1796.  
  1797.     LIBS_save="${LIBS}"
  1798. LIBS="${LIBS} -lm"
  1799. have_lib=""
  1800. echo checking for -lm
  1801. cat > conftest.c <<EOF
  1802. #include "confdefs.h"
  1803.  
  1804. int main() { exit(0); }
  1805. int t() { main(); }
  1806. EOF
  1807. if eval $compile; then
  1808.   rm -rf conftest*
  1809.   have_lib="1"
  1810.  
  1811. fi
  1812. rm -f conftest*
  1813. LIBS="${LIBS_save}"
  1814. if test -n "${have_lib}"; then
  1815.    
  1816. {
  1817. test -n "$verbose" && \
  1818. echo "    defining HAVE_LIBM"
  1819. echo "#define" HAVE_LIBM 1 >> confdefs.h
  1820. DEFS="$DEFS -DHAVE_LIBM=1"
  1821. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_LIBM\${SEDdB}HAVE_LIBM\${SEDdC}1\${SEDdD}
  1822. \${SEDuA}HAVE_LIBM\${SEDuB}HAVE_LIBM\${SEDuC}1\${SEDuD}
  1823. \${SEDeA}HAVE_LIBM\${SEDeB}HAVE_LIBM\${SEDeC}1\${SEDeD}
  1824. "
  1825. }
  1826.  
  1827.    LIBS="${LIBS} -lm"
  1828. fi
  1829.  
  1830.   for func in difftime rint rindex
  1831. do
  1832. trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'`
  1833. echo checking for ${func}
  1834. cat > conftest.c <<EOF
  1835. #include "confdefs.h"
  1836. #include <ctype.h>
  1837. int main() { exit(0); }
  1838. int t() { 
  1839. /* The GNU C library defines this for functions which it implements
  1840.     to always fail with ENOSYS.  Some functions are actually named
  1841.     something starting with __ and the normal name is an alias.  */
  1842. #if defined (__stub_${func}) || defined (__stub___${func})
  1843. choke me
  1844. #else
  1845. /* Override any gcc2 internal prototype to avoid an error.  */
  1846. extern char ${func}(); ${func}();
  1847. #endif
  1848.  }
  1849. EOF
  1850. if eval $compile; then
  1851.   rm -rf conftest*
  1852.   {
  1853. test -n "$verbose" && \
  1854. echo "    defining ${trfunc}"
  1855. echo "#define" ${trfunc} 1 >> confdefs.h
  1856. DEFS="$DEFS -D${trfunc}=1"
  1857. SEDDEFS="${SEDDEFS}\${SEDdA}${trfunc}\${SEDdB}${trfunc}\${SEDdC}1\${SEDdD}
  1858. \${SEDuA}${trfunc}\${SEDuB}${trfunc}\${SEDuC}1\${SEDuD}
  1859. \${SEDeA}${trfunc}\${SEDeB}${trfunc}\${SEDeC}1\${SEDeD}
  1860. "
  1861. }
  1862.  
  1863.  
  1864. fi
  1865. rm -f conftest*
  1866. done
  1867.  
  1868.   # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
  1869. # for constant arguments.  Useless!
  1870. echo checking for working alloca.h
  1871. cat > conftest.c <<EOF
  1872. #include "confdefs.h"
  1873. #include <alloca.h>
  1874. int main() { exit(0); }
  1875. int t() { char *p = alloca(2 * sizeof(int)); }
  1876. EOF
  1877. if eval $compile; then
  1878.   rm -rf conftest*
  1879.   
  1880. {
  1881. test -n "$verbose" && \
  1882. echo "    defining HAVE_ALLOCA_H"
  1883. echo "#define" HAVE_ALLOCA_H 1 >> confdefs.h
  1884. DEFS="$DEFS -DHAVE_ALLOCA_H=1"
  1885. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_ALLOCA_H\${SEDdB}HAVE_ALLOCA_H\${SEDdC}1\${SEDdD}
  1886. \${SEDuA}HAVE_ALLOCA_H\${SEDuB}HAVE_ALLOCA_H\${SEDuC}1\${SEDuD}
  1887. \${SEDeA}HAVE_ALLOCA_H\${SEDeB}HAVE_ALLOCA_H\${SEDeC}1\${SEDeD}
  1888. "
  1889. }
  1890.  
  1891.  
  1892. fi
  1893. rm -f conftest*
  1894.  
  1895. decl="#ifdef __GNUC__
  1896. #define alloca __builtin_alloca
  1897. #else
  1898. #if HAVE_ALLOCA_H
  1899. #include <alloca.h>
  1900. #else
  1901. #ifdef _AIX
  1902.  #pragma alloca
  1903. #else
  1904. char *alloca ();
  1905. #endif
  1906. #endif
  1907. #endif
  1908. "
  1909. echo checking for alloca
  1910. cat > conftest.c <<EOF
  1911. #include "confdefs.h"
  1912. $decl
  1913. int main() { exit(0); }
  1914. int t() { char *p = (char *) alloca(1); }
  1915. EOF
  1916. if eval $compile; then
  1917.   :
  1918. else
  1919.   rm -rf conftest*
  1920.   alloca_missing=1
  1921. cat > conftest.c <<EOF
  1922. #include "confdefs.h"
  1923.  
  1924. #if defined(CRAY) && ! defined(CRAY2)
  1925. winnitude
  1926. #else
  1927. lossage
  1928. #endif
  1929.  
  1930. EOF
  1931. eval "$CPP conftest.c > conftest.out 2>&1"
  1932. if egrep "winnitude" conftest.out >/dev/null 2>&1; then
  1933.   rm -rf conftest*
  1934.   echo checking for _getb67
  1935. cat > conftest.c <<EOF
  1936. #include "confdefs.h"
  1937. #include <ctype.h>
  1938. int main() { exit(0); }
  1939. int t() { 
  1940. /* The GNU C library defines this for functions which it implements
  1941.     to always fail with ENOSYS.  Some functions are actually named
  1942.     something starting with __ and the normal name is an alias.  */
  1943. #if defined (__stub__getb67) || defined (__stub____getb67)
  1944. choke me
  1945. #else
  1946. /* Override any gcc2 internal prototype to avoid an error.  */
  1947. extern char _getb67(); _getb67();
  1948. #endif
  1949.  }
  1950. EOF
  1951. if eval $compile; then
  1952.   rm -rf conftest*
  1953.   {
  1954. test -n "$verbose" && \
  1955. echo "    defining" CRAY_STACKSEG_END to be _getb67
  1956. echo "#define" CRAY_STACKSEG_END _getb67 >> confdefs.h
  1957. DEFS="$DEFS -DCRAY_STACKSEG_END=_getb67"
  1958. SEDDEFS="${SEDDEFS}\${SEDdA}CRAY_STACKSEG_END\${SEDdB}CRAY_STACKSEG_END\${SEDdC}_getb67\${SEDdD}
  1959. \${SEDuA}CRAY_STACKSEG_END\${SEDuB}CRAY_STACKSEG_END\${SEDuC}_getb67\${SEDuD}
  1960. \${SEDeA}CRAY_STACKSEG_END\${SEDeB}CRAY_STACKSEG_END\${SEDeC}_getb67\${SEDeD}
  1961. "
  1962. }
  1963.  
  1964.  
  1965. else
  1966.   rm -rf conftest*
  1967.   echo checking for GETB67
  1968. cat > conftest.c <<EOF
  1969. #include "confdefs.h"
  1970. #include <ctype.h>
  1971. int main() { exit(0); }
  1972. int t() { 
  1973. /* The GNU C library defines this for functions which it implements
  1974.     to always fail with ENOSYS.  Some functions are actually named
  1975.     something starting with __ and the normal name is an alias.  */
  1976. #if defined (__stub_GETB67) || defined (__stub___GETB67)
  1977. choke me
  1978. #else
  1979. /* Override any gcc2 internal prototype to avoid an error.  */
  1980. extern char GETB67(); GETB67();
  1981. #endif
  1982.  }
  1983. EOF
  1984. if eval $compile; then
  1985.   rm -rf conftest*
  1986.   {
  1987. test -n "$verbose" && \
  1988. echo "    defining" CRAY_STACKSEG_END to be GETB67
  1989. echo "#define" CRAY_STACKSEG_END GETB67 >> confdefs.h
  1990. DEFS="$DEFS -DCRAY_STACKSEG_END=GETB67"
  1991. SEDDEFS="${SEDDEFS}\${SEDdA}CRAY_STACKSEG_END\${SEDdB}CRAY_STACKSEG_END\${SEDdC}GETB67\${SEDdD}
  1992. \${SEDuA}CRAY_STACKSEG_END\${SEDuB}CRAY_STACKSEG_END\${SEDuC}GETB67\${SEDuD}
  1993. \${SEDeA}CRAY_STACKSEG_END\${SEDeB}CRAY_STACKSEG_END\${SEDeC}GETB67\${SEDeD}
  1994. "
  1995. }
  1996.  
  1997.  
  1998. else
  1999.   rm -rf conftest*
  2000.   echo checking for getb67
  2001. cat > conftest.c <<EOF
  2002. #include "confdefs.h"
  2003. #include <ctype.h>
  2004. int main() { exit(0); }
  2005. int t() { 
  2006. /* The GNU C library defines this for functions which it implements
  2007.     to always fail with ENOSYS.  Some functions are actually named
  2008.     something starting with __ and the normal name is an alias.  */
  2009. #if defined (__stub_getb67) || defined (__stub___getb67)
  2010. choke me
  2011. #else
  2012. /* Override any gcc2 internal prototype to avoid an error.  */
  2013. extern char getb67(); getb67();
  2014. #endif
  2015.  }
  2016. EOF
  2017. if eval $compile; then
  2018.   rm -rf conftest*
  2019.   {
  2020. test -n "$verbose" && \
  2021. echo "    defining" CRAY_STACKSEG_END to be getb67
  2022. echo "#define" CRAY_STACKSEG_END getb67 >> confdefs.h
  2023. DEFS="$DEFS -DCRAY_STACKSEG_END=getb67"
  2024. SEDDEFS="${SEDDEFS}\${SEDdA}CRAY_STACKSEG_END\${SEDdB}CRAY_STACKSEG_END\${SEDdC}getb67\${SEDdD}
  2025. \${SEDuA}CRAY_STACKSEG_END\${SEDuB}CRAY_STACKSEG_END\${SEDuC}getb67\${SEDuD}
  2026. \${SEDeA}CRAY_STACKSEG_END\${SEDeB}CRAY_STACKSEG_END\${SEDeC}getb67\${SEDeD}
  2027. "
  2028. }
  2029.  
  2030.  
  2031. fi
  2032. rm -f conftest*
  2033.  
  2034. fi
  2035. rm -f conftest*
  2036.  
  2037. fi
  2038. rm -f conftest*
  2039.  
  2040.  
  2041. fi
  2042. rm -f conftest*
  2043.  
  2044.  
  2045. fi
  2046. rm -f conftest*
  2047.  
  2048. if test -n "$alloca_missing"; then
  2049.   # The SVR3 libPW and SVR4 libucb both contain incompatible functions
  2050.   # that cause trouble.  Some versions do not even contain alloca or
  2051.   # contain a buggy version.  If you still want to use their alloca,
  2052.   # use ar to extract alloca.o from them instead of compiling alloca.c.
  2053.   ALLOCA=alloca.o
  2054.   
  2055. {
  2056. test -n "$verbose" && \
  2057. echo "    defining C_ALLOCA"
  2058. echo "#define" C_ALLOCA 1 >> confdefs.h
  2059. DEFS="$DEFS -DC_ALLOCA=1"
  2060. SEDDEFS="${SEDDEFS}\${SEDdA}C_ALLOCA\${SEDdB}C_ALLOCA\${SEDdC}1\${SEDdD}
  2061. \${SEDuA}C_ALLOCA\${SEDuB}C_ALLOCA\${SEDuC}1\${SEDuD}
  2062. \${SEDeA}C_ALLOCA\${SEDeB}C_ALLOCA\${SEDeC}1\${SEDeD}
  2063. "
  2064. }
  2065.  
  2066.  
  2067.   echo 'checking stack direction for C alloca'
  2068.   if test -n "$cross_compiling"
  2069. then
  2070.   
  2071. {
  2072. test -n "$verbose" && \
  2073. echo "    defining" STACK_DIRECTION to be 0
  2074. echo "#define" STACK_DIRECTION 0 >> confdefs.h
  2075. DEFS="$DEFS -DSTACK_DIRECTION=0"
  2076. SEDDEFS="${SEDDEFS}\${SEDdA}STACK_DIRECTION\${SEDdB}STACK_DIRECTION\${SEDdC}0\${SEDdD}
  2077. \${SEDuA}STACK_DIRECTION\${SEDuB}STACK_DIRECTION\${SEDuC}0\${SEDuD}
  2078. \${SEDeA}STACK_DIRECTION\${SEDeB}STACK_DIRECTION\${SEDeC}0\${SEDeD}
  2079. "
  2080. }
  2081.  
  2082. else
  2083. cat > conftest.c <<EOF
  2084. #include "confdefs.h"
  2085. find_stack_direction ()
  2086. {
  2087.   static char *addr = 0;
  2088.   auto char dummy;
  2089.   if (addr == 0)
  2090.     {
  2091.       addr = &dummy;
  2092.       return find_stack_direction ();
  2093.     }
  2094.   else
  2095.     return (&dummy > addr) ? 1 : -1;
  2096. }
  2097. main ()
  2098. {
  2099.   exit (find_stack_direction() < 0);
  2100. }
  2101. EOF
  2102. eval $compile
  2103. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  2104.   
  2105. {
  2106. test -n "$verbose" && \
  2107. echo "    defining" STACK_DIRECTION to be 1
  2108. echo "#define" STACK_DIRECTION 1 >> confdefs.h
  2109. DEFS="$DEFS -DSTACK_DIRECTION=1"
  2110. SEDDEFS="${SEDDEFS}\${SEDdA}STACK_DIRECTION\${SEDdB}STACK_DIRECTION\${SEDdC}1\${SEDdD}
  2111. \${SEDuA}STACK_DIRECTION\${SEDuB}STACK_DIRECTION\${SEDuC}1\${SEDuD}
  2112. \${SEDeA}STACK_DIRECTION\${SEDeB}STACK_DIRECTION\${SEDeC}1\${SEDeD}
  2113. "
  2114. }
  2115.  
  2116.  
  2117. else
  2118.   
  2119. {
  2120. test -n "$verbose" && \
  2121. echo "    defining" STACK_DIRECTION to be -1
  2122. echo "#define" STACK_DIRECTION -1 >> confdefs.h
  2123. DEFS="$DEFS -DSTACK_DIRECTION=-1"
  2124. SEDDEFS="${SEDDEFS}\${SEDdA}STACK_DIRECTION\${SEDdB}STACK_DIRECTION\${SEDdC}-1\${SEDdD}
  2125. \${SEDuA}STACK_DIRECTION\${SEDuB}STACK_DIRECTION\${SEDuC}-1\${SEDuD}
  2126. \${SEDeA}STACK_DIRECTION\${SEDeB}STACK_DIRECTION\${SEDeC}-1\${SEDeD}
  2127. "
  2128. }
  2129.  
  2130. fi
  2131. fi
  2132. rm -fr conftest*
  2133. fi
  2134.  
  2135. fi
  2136.  
  2137.  
  2138. echo checking for fprintf dec
  2139. cat > conftest.c <<EOF
  2140. #include "confdefs.h"
  2141. #include <stdio.h>
  2142. int main() { exit(0); }
  2143. int t() { int (*x)()=(int(*)())fprintf; }
  2144. EOF
  2145. if eval $compile; then
  2146.   rm -rf conftest*
  2147.   
  2148. {
  2149. test -n "$verbose" && \
  2150. echo "    defining HAVE_FPRINTF_DEC"
  2151. echo "#define" HAVE_FPRINTF_DEC 1 >> confdefs.h
  2152. DEFS="$DEFS -DHAVE_FPRINTF_DEC=1"
  2153. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_FPRINTF_DEC\${SEDdB}HAVE_FPRINTF_DEC\${SEDdC}1\${SEDdD}
  2154. \${SEDuA}HAVE_FPRINTF_DEC\${SEDuB}HAVE_FPRINTF_DEC\${SEDuC}1\${SEDuD}
  2155. \${SEDeA}HAVE_FPRINTF_DEC\${SEDeB}HAVE_FPRINTF_DEC\${SEDeC}1\${SEDeD}
  2156. "
  2157. }
  2158.  
  2159.  
  2160. fi
  2161. rm -f conftest*
  2162.  
  2163. echo checking for sprintf dec
  2164. cat > conftest.c <<EOF
  2165. #include "confdefs.h"
  2166. #include <stdio.h>
  2167. int main() { exit(0); }
  2168. int t() { int (*x)()=(int(*)())sprintf; }
  2169. EOF
  2170. if eval $compile; then
  2171.   rm -rf conftest*
  2172.   
  2173. {
  2174. test -n "$verbose" && \
  2175. echo "    defining HAVE_SPRINTF_DEC"
  2176. echo "#define" HAVE_SPRINTF_DEC 1 >> confdefs.h
  2177. DEFS="$DEFS -DHAVE_SPRINTF_DEC=1"
  2178. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_SPRINTF_DEC\${SEDdB}HAVE_SPRINTF_DEC\${SEDdC}1\${SEDdD}
  2179. \${SEDuA}HAVE_SPRINTF_DEC\${SEDuB}HAVE_SPRINTF_DEC\${SEDuC}1\${SEDuD}
  2180. \${SEDeA}HAVE_SPRINTF_DEC\${SEDeB}HAVE_SPRINTF_DEC\${SEDeC}1\${SEDeD}
  2181. "
  2182. }
  2183.  
  2184.  
  2185. fi
  2186. rm -f conftest*
  2187.  
  2188.  
  2189.  
  2190.  
  2191.  
  2192.  
  2193.  
  2194.  
  2195.  
  2196.  
  2197.  
  2198.  
  2199.  
  2200.  
  2201.  
  2202.  
  2203. # Set default prefixes.
  2204. if test -n "$prefix"; then
  2205.   test -z "$exec_prefix" && exec_prefix='${prefix}'
  2206.   prsub="s%^prefix\\([     ]*\\)=\\([     ]*\\).*$%prefix\\1=\\2$prefix%"
  2207. fi
  2208. if test -n "$exec_prefix"; then
  2209.   prsub="$prsub
  2210. s%^exec_prefix\\([     ]*\\)=\\([     ]*\\).*$%exec_prefix\\1=\\2$exec_prefix%"
  2211. fi
  2212. # Quote sed substitution magic chars in DEFS.
  2213. cat >conftest.def <<EOF
  2214. $DEFS
  2215. EOF
  2216. escape_ampersand_and_backslash='s%[&\\]%\\&%g'
  2217. DEFS=`sed "$escape_ampersand_and_backslash" <conftest.def`
  2218. rm -f conftest.def
  2219. # Substitute for predefined variables.
  2220.  
  2221. trap 'rm -f config.status; exit 1' 1 3 15
  2222. echo creating config.status
  2223. rm -f config.status
  2224. cat > config.status <<EOF
  2225. #!/bin/sh
  2226. # Generated automatically by configure.
  2227. # Run this file to recreate the current configuration.
  2228. # This directory was configured as follows,
  2229. # on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
  2230. #
  2231. # $0 $configure_args
  2232.  
  2233. for arg
  2234. do
  2235.   case "\$arg" in
  2236.     -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
  2237.     echo running \${CONFIG_SHELL-/bin/sh} $0 $configure_args
  2238.     exec \${CONFIG_SHELL-/bin/sh} $0 $configure_args ;;
  2239.     *) echo "Usage: config.status --recheck" 2>&1; exit 1 ;;
  2240.   esac
  2241. done
  2242.  
  2243. trap 'rm -fr Makefile config.h conftest*; exit 1' 1 3 15
  2244. YACC='$YACC'
  2245. FLEX='$FLEX'
  2246. AWK='$AWK'
  2247. INSTALL='$INSTALL'
  2248. INSTALL_PROGRAM='$INSTALL_PROGRAM'
  2249. INSTALL_DATA='$INSTALL_DATA'
  2250. F2C='$F2C'
  2251. CC='$CC'
  2252. CPP='$CPP'
  2253. PAGER='$PAGER'
  2254. PLOT_PROG='$PLOT_PROG'
  2255. ALLOCA='$ALLOCA'
  2256. LLIBS='$LLIBS'
  2257. NALIBS='$NALIBS'
  2258. FLIBS='$FLIBS'
  2259. CMDLIBS='$CMDLIBS'
  2260. PLIBS='$PLIBS'
  2261. PLIB_INC_DIR='$PLIB_INC_DIR'
  2262. LIBS='$LIBS'
  2263. srcdir='$srcdir'
  2264. prefix='$prefix'
  2265. exec_prefix='$exec_prefix'
  2266. prsub='$prsub'
  2267. extrasub='$extrasub'
  2268. EOF
  2269. cat >> config.status <<\EOF
  2270.  
  2271. top_srcdir=$srcdir
  2272.  
  2273. CONFIG_FILES=${CONFIG_FILES-"Makefile"}
  2274. for file in .. ${CONFIG_FILES}; do if test "x$file" != x..; then
  2275.   srcdir=$top_srcdir
  2276.   # Remove last slash and all that follows it.  Not all systems have dirname.
  2277.   dir=`echo $file|sed 's%/[^/][^/]*$%%'`
  2278.   if test "$dir" != "$file"; then
  2279.     test "$top_srcdir" != . && srcdir=$top_srcdir/$dir
  2280.     test ! -d $dir && mkdir $dir
  2281.   fi
  2282.   echo creating $file
  2283.   rm -f $file
  2284.   echo "# Generated automatically from `echo $file|sed 's|.*/||'`.in by configure." > $file
  2285.   sed -e "
  2286. $prsub
  2287. $extrasub
  2288. s%@YACC@%$YACC%g
  2289. s%@FLEX@%$FLEX%g
  2290. s%@AWK@%$AWK%g
  2291. s%@INSTALL@%$INSTALL%g
  2292. s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
  2293. s%@INSTALL_DATA@%$INSTALL_DATA%g
  2294. s%@F2C@%$F2C%g
  2295. s%@CC@%$CC%g
  2296. s%@CPP@%$CPP%g
  2297. s%@PAGER@%$PAGER%g
  2298. s%@PLOT_PROG@%$PLOT_PROG%g
  2299. s%@ALLOCA@%$ALLOCA%g
  2300. s%@LLIBS@%$LLIBS%g
  2301. s%@NALIBS@%$NALIBS%g
  2302. s%@FLIBS@%$FLIBS%g
  2303. s%@CMDLIBS@%$CMDLIBS%g
  2304. s%@PLIBS@%$PLIBS%g
  2305. s%@PLIB_INC_DIR@%$PLIB_INC_DIR%g
  2306. s%@LIBS@%$LIBS%g
  2307. s%@srcdir@%$srcdir%g
  2308. s%@DEFS@%-DHAVE_CONFIG_H%" $top_srcdir/${file}.in >> $file
  2309. fi; done
  2310.  
  2311. CONFIG_HEADERS=${CONFIG_HEADERS-"config.h"}
  2312. for file in .. ${CONFIG_HEADERS}; do if test "x$file" != x..; then
  2313. echo creating $file
  2314.  
  2315. # These sed commands are put into SEDDEFS when defining a macro.
  2316. # They are broken into pieces to make the sed script easier to manage.
  2317. # They are passed to sed as "A NAME B NAME C VALUE D", where NAME
  2318. # is the cpp macro being defined and VALUE is the value it is being given.
  2319. # Each defining turns into a single global substitution command.
  2320. #
  2321. # SEDd sets the value in "#define NAME VALUE" lines.
  2322. SEDdA='s@^\([     ]*\)#\([     ]*define[     ][     ]*\)'
  2323. SEDdB='\([     ][     ]*\)[^     ]*@\1#\2'
  2324. SEDdC='\3'
  2325. SEDdD='@g'
  2326. # SEDu turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
  2327. SEDuA='s@^\([     ]*\)#\([     ]*\)undef\([     ][     ]*\)'
  2328. SEDuB='\([     ]\)@\1#\2define\3'
  2329. SEDuC=' '
  2330. SEDuD='\4@g'
  2331. # SEDe turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
  2332. SEDeA='s@^\([     ]*\)#\([     ]*\)undef\([     ][     ]*\)'
  2333. SEDeB='$@\1#\2define\3'
  2334. SEDeC=' '
  2335. SEDeD='@g'
  2336. rm -f conftest.sed
  2337. EOF
  2338. # Turn off quoting long enough to insert the sed commands.
  2339. rm -f conftest.sh
  2340. cat > conftest.sh <<EOF
  2341. $SEDDEFS
  2342. EOF
  2343.  
  2344. # Break up $SEDDEFS (now in conftest.sh) because some shells have a limit
  2345. # on the size of here documents.
  2346.  
  2347. # Maximum number of lines to put in a single here document.
  2348. maxshlines=9
  2349.  
  2350. while :
  2351. do
  2352.   # wc gives bogus results for an empty file on some systems.
  2353.   lines=`grep -c . conftest.sh`
  2354.   if test -z "$lines" || test "$lines" -eq 0; then break; fi
  2355.   rm -f conftest.s1 conftest.s2
  2356.   sed ${maxshlines}q conftest.sh > conftest.s1 # Like head -20.
  2357.   sed 1,${maxshlines}d conftest.sh > conftest.s2 # Like tail +21.
  2358.   # Write a limited-size here document to append to conftest.sed.
  2359.   echo 'cat >> conftest.sed <<CONFEOF' >> config.status
  2360.   cat conftest.s1 >> config.status
  2361.   echo 'CONFEOF' >> config.status
  2362.   rm -f conftest.s1 conftest.sh
  2363.   mv conftest.s2 conftest.sh
  2364. done
  2365. rm -f conftest.sh
  2366.  
  2367. # Now back to your regularly scheduled config.status.
  2368. cat >> config.status <<\EOF
  2369. # This sed command replaces #undef's with comments.  This is necessary, for
  2370. # example, in the case of _POSIX_SOURCE, which is predefined and required
  2371. # on some systems where configure will not decide to define it in
  2372. # config.h.
  2373. cat >> conftest.sed <<\CONFEOF
  2374. s,^[     ]*#[     ]*undef[     ][     ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */,
  2375. CONFEOF
  2376. rm -f conftest.h
  2377. # Break up the sed commands because old seds have small limits.
  2378. maxsedlines=20
  2379. cp $top_srcdir/$file.in conftest.h1
  2380. while :
  2381. do
  2382.   lines=`grep -c . conftest.sed`
  2383.   if test -z "$lines" || test "$lines" -eq 0; then break; fi
  2384.   rm -f conftest.s1 conftest.s2 conftest.h2
  2385.   sed ${maxsedlines}q conftest.sed > conftest.s1 # Like head -20.
  2386.   sed 1,${maxsedlines}d conftest.sed > conftest.s2 # Like tail +21.
  2387.   sed -f conftest.s1 < conftest.h1 > conftest.h2
  2388.   rm -f conftest.s1 conftest.h1 conftest.sed
  2389.   mv conftest.h2 conftest.h1
  2390.   mv conftest.s2 conftest.sed
  2391. done
  2392. rm -f conftest.sed conftest.h
  2393. echo "/* $file.  Generated automatically by configure.  */" > conftest.h
  2394. cat conftest.h1 >> conftest.h
  2395. rm -f conftest.h1
  2396. if cmp -s $file conftest.h 2>/dev/null; then
  2397.   # The file exists and we would not be changing it.
  2398.   echo "$file is unchanged"
  2399.   rm -f conftest.h
  2400. else
  2401.   rm -f $file
  2402.   mv conftest.h $file
  2403. fi
  2404. fi; done
  2405.  
  2406.  
  2407.  
  2408. exit 0
  2409. EOF
  2410. chmod +x config.status
  2411. ${CONFIG_SHELL-/bin/sh} config.status
  2412.  
  2413.